# @Time    : 2020/9/24 10:02
# @Author  : Del Fung
# @File    : tag_conversion.py
# @Software: PyCharm
# 进行数据标记转换，包括计算格式转换等属于公共工具，不进行类化

from pypinyin import lazy_pinyin
from pywubi import wubi
import datetime

__all__ = ['string2pym', 'string2wbm', 'get_str_now_datetime']


def string2pym(string):
    py_list = []
    temp_pym_str = lazy_pinyin(string, 4)
    for i in range(len(temp_pym_str)):
        py_list.append(str(temp_pym_str[i][0]).upper())
    return F"""\"{''.join(py_list)}\""""


def string2wbm(string):
    wubi_list = []
    temp_wbm_list = wubi(string)
    for one_str in temp_wbm_list:
        wubi_list.append(str(one_str[0]).upper())
    return f"""\"{''.join(wubi_list)}\""""


def get_str_now_datetime():
    return f"""\"{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}\""""
